21. 神秘的形状

夹角列表

在上个示例中,你见过一个数字列表,并且程序将每个数字当做 距离 。下面是另一个数字列表。每个数字都应当做 夹角

angles = [-90, 0, 0, -90,
          135, 0, 0, 0, 
          90, 0, 0, 0,
          135, -90, 0, 0,
          90, 0, 0, 0]

请将此夹角列表复制到下面的代码中。然后填写使用它的 for 循环。

此循环的效果必须和你刚刚看到的一样,但是我们将使距离保持不变,并更改夹角,而不是使夹角保持不变并更改距离。因此,在循环里,使 turtle 按照列表( angle 变量)中的数字右转,然后向前移动 25 个像素。

它画出了什么形状?

(如果遇到问题,请参阅下面的解决方案。)

Task Description:

完成这些操作后,请选中它们 —

Task List:

Task Feedback:

看来你已经知道如何遍历列表了!

Workspace

This section contains either a workspace (it can be a Jupyter Notebook workspace or an online code editor work space, etc.) and it cannot be automatically downloaded to be generated here. Please access the classroom with your account and manually download the workspace to your local machine. Note that for some courses, Udacity upload the workspace files onto https://github.com/udacity , so you may be able to download them there.

Workspace Information:

  • Default file path:
  • Workspace type: html-live
  • Opened files (when workspace is loaded): n/a

备注 :如果你无法打开上面的workspace,请去 这里

它画出了什么形状?

SOLUTION: 一座房子,或者一个箭头

Python:神秘形状演示